London | 25-SDC-Nov | Emiliano Uruena | Sprint 3 | Decomposition Middleware - #63
London | 25-SDC-Nov | Emiliano Uruena | Sprint 3 | Decomposition Middleware#63Emilianouz wants to merge 2 commits into
Conversation
…igure .gitignore and package.json
OracPrime
left a comment
There was a problem hiding this comment.
Couple of minor corrections required, otherwise excellent
| const usernameMiddleware = (req,res,next) => { | ||
| const usernameHeader = req.get('X-Username'); | ||
| // if exists, set if, otherwise set to null | ||
| req.username = usernameHeader || null; |
There was a problem hiding this comment.
Are you intentionally using || rather than ?? here? If yes, and you understand the difference, that's fine.
|
|
||
| // middleware for body parsing and validation | ||
|
|
||
| app.use(express.text({ type: 'application/json'})); |
There was a problem hiding this comment.
Nice! adding that type parameter is necessary for this use case but easy to forget
|
|
||
| // middleware for body parsing and validation | ||
|
|
||
| app.use(express.text({ type: 'application/json'})); |
There was a problem hiding this comment.
I suspect you failed to delete this after the first half. Luckily because express.json comes before this in the list you get away with it, but I think this line needs removing.
| @@ -0,0 +1,2 @@ | |||
| /node_modules | |||
| package-lock.json No newline at end of file | |||
There was a problem hiding this comment.
No, you shouldn't ignore package-lock.json. Checking this file into version control is what allows another developer (or you, later) to replicate your build.
|
Closing PR because the SDC run has finished. Feel free to re-open if you're still working on it. |
Changelist
Middleware for user authentication and array validation, and configure .gitignore and package.json